<?php
require_once('facebook.php');

$facebook = new Facebook("87c749ab2b66ec2c60f542d13647555c","a9502b949632873d575cb6242eb4d525");
set_time_limit  ( 1000000 );

$friendsCheck = $_POST["friends"];
$groupsCheck = $_POST["groups"];
$albumsCheck = $_POST["albums"];

$show[0] = false;
$show[1] = false;
$show[2] = false;

if($friendsCheck == "on"){
	$show[0] = true;
}

if($groupsCheck == "on"){
	$show[1] = true;
}

if($albumsCheck == "on"){
	$show[2] = true;
}

if(!$show[0] && !$show[1] && !$show[2])
$show[0] = true;

$fb_user = $facebook->require_login();
$myName = $facebook->api_client->users_getInfo($fb_user, 'name');
if($show[2]){
	$albums = $facebook->api_client->photos_getAlbums($fb_user, NULL);
}
if($show[1]){
	$groups = $facebook->api_client->groups_get($fb_user, NULL);
}
if($show[0]){
	$fields = array('uid', 'last_name','first_name', 'meeting_for', 'meeting_sex', 'sex', 'relationship_status');
	$friends = $facebook->api_client->users_getinfo($facebook->api_client->friends_get(), $fields);
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Connect to your friends with Buddy Map</title>

<style type="text/css">
/*Menu Links*/
	/*NOTE: anything not specified for the #(menu id's) a selector and its pseudo classes
		may be inherited in some browsers from other 'a' element styles (if any) on the page*/
#menu1 a {
	color: black;
	background-color: white;
	text-decoration: none;
	text-indent: 1ex;
}

#menu1 a:active {
	color: black;
	text-decoration: none;
}

#menu1 a:hover {
	color: black;
	background-color: #FFFF99
}

#menu1 a:visited {
	color: black;
	text-decoration: none;
}

#menu2 a {
	color: navy;
	background-color: white;
	text-decoration: none;
	text-indent: 1ex;
}

#menu2 a:active {
	color: blue;
	text-decoration: none;
}

#menu2 a:visited {
	color: blue;
	text-decoration: none;
}

#menu2 a:hover {
	color: navy;
	background-color: #f0fea8
}

#menu3 a { /*Menu3 Links*/
	color: black;
	background-color: white;
	text-decoration: none;
	text-indent: 1ex;
}

#menu3 a:hover {
	color: black;
	background-color: #FFFF99;
}

#menu3 a:active {
	color: black;
	text-decoration: none;
}

#menu3 a:visited {
	color: black;
	text-decoration: none;
}

.fbbody {
	font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
	font-size: 11px;
	color: #333333;
}
/*End Menu Links*/
</style>

<script type="text/javascript">	


		function setRightMenu(control){
			if(control == ""){				
				document.getElementById("sexCheck").checked = true;
				document.getElementById("maleCheck").checked = true;						
				document.getElementById("femaleCheck").checked = true;	
				document.getElementById("sexUn").checked = true;
				document.getElementById("lForCheck").checked = true;	
				document.getElementById("friendshipCheck").checked = true;						
				document.getElementById("datingCheck").checked = true;	
				document.getElementById("relationshipCheck").checked = true;
				document.getElementById("networkingCheck").checked = true;						
				document.getElementById("lForUn").checked = true;	
				document.getElementById("rStatusCheck").checked = true;
				document.getElementById("singleCheck").checked = true;
				document.getElementById("inRelationshipCheck").checked = true;						
				document.getElementById("engagedCheck").checked = true;	
				document.getElementById("marriedCheck").checked = true;
				document.getElementById("complicatedCheck").checked = true;						
				document.getElementById("openRelationshipCheck").checked = true;	
				document.getElementById("rStatusUn").checked = true;
				document.getElementById("interestedInCheck").checked = true;	
				document.getElementById("menCheck").checked = true;						
				document.getElementById("womenCheck").checked = true;	
				document.getElementById("intInUn").checked = true;	
			}	
			else if(control == "sexCheck"){				
				document.getElementById("maleCheck").checked = document.getElementById("sexCheck").checked;						
				document.getElementById("femaleCheck").checked = document.getElementById("sexCheck").checked;	
				document.getElementById("sexUn").checked = document.getElementById("sexCheck").checked;				
			}	
			else if(control == "sexCheckAll"){
				if(document.getElementById("maleCheck").checked && document.getElementById("femaleCheck").checked &&
						document.getElementById("sexUn").checked)				
					document.getElementById("sexCheck").checked = true;		
				else document.getElementById("sexCheck").checked = false;	
			}
			else if(control == "lForCheck"){				
				document.getElementById("friendshipCheck").checked = document.getElementById("lForCheck").checked;						
				document.getElementById("datingCheck").checked = document.getElementById("lForCheck").checked;	
				document.getElementById("relationshipCheck").checked = document.getElementById("lForCheck").checked;
				document.getElementById("networkingCheck").checked = document.getElementById("lForCheck").checked;						
				document.getElementById("lForUn").checked = document.getElementById("lForCheck").checked;				
			}	
			else if(control == "lForCheckAll"){				
				if(document.getElementById("friendshipCheck").checked && document.getElementById("datingCheck").checked &&
						document.getElementById("relationshipCheck").checked && document.getElementById("networkingCheck").checked &&
						document.getElementById("lForUn").checked)				
					document.getElementById("lForCheck").checked = true;		
				else document.getElementById("lForCheck").checked = false;			
			}	
			else if(control == "rStatusCheck"){				
				document.getElementById("singleCheck").checked = document.getElementById("rStatusCheck").checked;						
				document.getElementById("inRelationshipCheck").checked = document.getElementById("rStatusCheck").checked;	
				document.getElementById("engagedCheck").checked = document.getElementById("rStatusCheck").checked;
				document.getElementById("marriedCheck").checked = document.getElementById("rStatusCheck").checked;						
				document.getElementById("complicatedCheck").checked = document.getElementById("rStatusCheck").checked;	
				document.getElementById("openRelationshipCheck").checked = document.getElementById("rStatusCheck").checked;
				document.getElementById("rStatusUn").checked = document.getElementById("rStatusCheck").checked;			
			}	
			else if(control == "rStatusCheckAll"){				
				if(document.getElementById("singleCheck").checked && document.getElementById("inRelationshipCheck").checked &&
						document.getElementById("engagedCheck").checked && document.getElementById("marriedCheck").checked &&
						document.getElementById("complicatedCheck").checked && document.getElementById("openRelationshipCheck").checked &&
						document.getElementById("rStatusUn").checked)				
					document.getElementById("rStatusCheck").checked = true;		
				else document.getElementById("rStatusCheck").checked = false;			
			}
			else if(control == "interestedInCheck"){				
				document.getElementById("menCheck").checked = document.getElementById("interestedInCheck").checked;						
				document.getElementById("womenCheck").checked = document.getElementById("interestedInCheck").checked;	
				document.getElementById("intInUn").checked = document.getElementById("interestedInCheck").checked;				
			}	
			else if(control == "interestedInCheckAll"){
				if(document.getElementById("menCheck").checked && document.getElementById("womenCheck").checked &&
						document.getElementById("intInUn").checked)				
					document.getElementById("interestedInCheck").checked = true;		
				else document.getElementById("interestedInCheck").checked = false;	
			}
		}

			
		function filter(){
			var key = "";
			
			if(document.getElementById("maleCheck").checked)
				key += "1";				
			else key += "0";			
			if(document.getElementById("femaleCheck").checked)
				key += "1";	
			else key += "0";	
			if(document.getElementById("sexUn").checked)
				key += "1";	
			else key += "0";	
			if(document.getElementById("friendshipCheck").checked)
				key += "1";
			else key += "0";								
			if(document.getElementById("datingCheck").checked)
				key += "1";
			else key += "0";				
			if(document.getElementById("relationshipCheck").checked)
				key += "1";
			else key += "0";				
			if(document.getElementById("networkingCheck").checked)
				key += "1";
			else key += "0";	
			if(document.getElementById("lForUn").checked)
				key += "1";
			else key += "0";	
			if(document.getElementById("singleCheck").checked)
					key += "1";	
			else key += "0";								
			if(document.getElementById("inRelationshipCheck").checked)
				key += "1";	
			else key += "0";					
			if(document.getElementById("engagedCheck").checked)
				key += "1";	
			else key += "0";				
			if(document.getElementById("marriedCheck").checked)
				key += "1";	
			else key += "0";						
			if(document.getElementById("complicatedCheck").checked)
				key += "1";	
			else key += "0";	
			if(document.getElementById("openRelationshipCheck").checked)
				key += "1";	
			else key += "0";
			if(document.getElementById("rStatusUn").checked)
				key += "1";	
			else key += "0";				
			if(document.getElementById("menCheck").checked)
				key += "1";	
			else key += "0";					
			if(document.getElementById("womenCheck").checked)
				key += "1";		
			else key += "0";	
			if(document.getElementById("intInUn").checked)
				key += "1";		
			else key += "0";				

			//layout.view.control = true;
			layout.models.remove(key);
		}
			
		function setChecks(){
			var s = "<?=$show[0]?>";						
			if(s == "1"){	
				//document.getElementById("friends").checked=true;
			}else{
				 //document.getElementById("friends").checked=false;
			}
			s = "<?=$show[1]?>";
			if(s == "1"){			
				document.getElementById("groups").checked=true;
			}else{
				 document.getElementById("groups").checked=false;
			}	
			s = "<?=$show[2]?>";
			if(s == "1"){		
				document.getElementById("albums").checked=true;
			}else{
				 document.getElementById("albums").checked=false;
			}					
			
		}

		function resetLeftMenu(){
			setLeft(<?=$fb_user?>, '');
		}

		function setLeftMenuImages(){
			if(layout.screen.current == 0){
				document.getElementById("photo2").src = "#";
				document.getElementById("selected").innerHTML = "("+layout.names[0]+")";
				resetLeftMenu();
			}

			else{

				if(layout.screen.current == 1){
	
					document.getElementById("selected").innerHTML = "("+layout.names[layout.screen.particles[0]]+")";
				}
	
				else if(layout.screen.current == 2){
	
					document.getElementById("selected").innerHTML = "("+layout.names[layout.screen.particles[0]]+", "+
													layout.names[layout.screen.particles[1]]+")";
				}
	
				else if(layout.screen.current == 3){			
	
					document.getElementById("selected").innerHTML = "("+layout.names[layout.screen.particles[0]]+", "+
					layout.names[layout.screen.particles[1]]+", "+layout.names[layout.screen.particles[2]]+")";
				}	
	
				document.getElementById("photo2").src = layout.screen.leftImage[layout.screen.current - 1];
				document.getElementById("name").innerHTML = layout.screen.name[layout.screen.current - 1];
				document.getElementById("info").innerHTML = layout.screen.info[layout.screen.current - 1];
				document.getElementById("rstatus").innerHTML = 	layout.screen.status[layout.screen.current - 1];
				document.getElementById("network").innerHTML = layout.screen.network[layout.screen.current - 1];
				document.getElementById("hometown").innerHTML = layout.screen.homeTown[layout.screen.current - 1];	
				document.getElementById("intin").innerHTML = layout.screen.interestedIn[layout.screen.current - 1];
			}		
		}
		
</script>

<!--	
			Licensed under the Apache License, Version 2.0 (the "License");
			you may not use this file except in compliance with the License.
 			You may obtain a copy of the License at
 
				http://www.apache.org/licenses/LICENSE-2.0

 			Unless required by applicable law or agreed to in writing, software
 			distributed under the License is distributed on an "AS IS" BASIS,
 			WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 			See the License for the specific language governing permissions and
 			limitations under the License.

 			Author: Kyle Scholz      http://kylescholz.com/
 			Copyright: 2006-2007
 		-->

<!-- JSViz Libraries -->
<script language="JavaScript" src="./physics/ParticleModel.js"></script>
<script language="JavaScript" src="./physics/Magnet.js"></script>
<script language="JavaScript" src="./physics/Spring.js"></script>
<script language="JavaScript" src="./physics/Particle.js"></script>
<script language="JavaScript" src="./physics/RungeKuttaIntegrator.js"></script>

<script language="JavaScript"
	src="./layout/graph/ForceDirectedLayout.js"></script>
<script language="JavaScript" src="./layout/view/HTMLGraphView.js"></script>
<script language="JavaScript" src="./layout/view/SVGGraphView.js"></script>

<script language="JavaScript" src="./util/Timer.js"></script>
<script language="JavaScript" src="./util/EventHandler.js"></script>

<script language="JavaScript" src="./io/DataGraph.js"></script>
<script language="JavaScript" src="./io/HTTP.js"></script>
<script language="JavaScript" src="./io/XMLTreeLoader.js"></script>

<script language="JavaScript" src="./Screen.js"></script>
<script language="JavaScript" src="./ModelCollection.js"></script>

<script type="text/javascript" src="treemenu.js"></script>
<link rel="stylesheet" type="text/css" href="facebook.css" />
<link rel="stylesheet" type="text/css" href="treeCSS.css" />

<script src="mmenu.js" type="text/javascript"></script>
<script src="menuItems.js" type="text/javascript"></script>

<script src="wz_jsgraphics.js" type="text/javascript"></script>

<script type="text/javascript">

	var wait = document.createElement('div');
	wait.style.position = "absolute";
	wait.style.display = "block";
	wait.style.left = "0px";
	wait.style.top = "0px";
	var widthX = ""+753+"px";//(this.outerWidth - 50)+"px";
	var heightX = ""+(this.innerHeight - 10)+"px";
	wait.style.background = "#6D7B8D";
	wait.style.border = "2px solid black";			
	wait.style.zIndex = "150";			
	wait.innerHTML = "<table width='"+widthX+"' height='"+heightX+"' bgcolor='#6D7B8D'><tr><td align='center' valign='middle'>"+
		"<img src='loading.gif' /><br /><img id='infoImg' name='infoImg' src='1.png'><br />"+
		"<img id='percent' name='percent' src='0.png'>"+
		"</td></tr></table>";
	wait.id = "pleaseWait";
	document.body.appendChild(wait);	

	ddtreemenu.createTree("treemenu1", false);
</script>

<script language="JavaScript">

		var globalNodes;
		var buildTimer;

			function init() {

				/* 1) Create a new SnowflakeLayout.
				 * 
				 * If you're going to place the graph in an HTML Element, other
				 * the <body>, remember that it must have a known size and
				 * position (via element.offsetWidth, element.offsetHeight,
				 * element.offsetTop, element.offsetLeft).
				 */
				 
				var layout = new ForceDirectedLayout( document.body, true );			
				
				layout.config._default = {
					model: function( dataNode ) {
						return {
							mass: .5
						}
					},
					view: function( dataNode, modelNode ) {
						if ( layout.svg ) {
							var nodeElement = document.createElementNS("http://www.w3.org/2000/svg", "circle");
							nodeElement.setAttribute('stroke', '#888888');
							nodeElement.setAttribute('stroke-width', '.25px');
							nodeElement.setAttribute('fill', dataNode.color);
							nodeElement.setAttribute('r', 10 + 'px');
							nodeElement.onmousedown =  new EventHandler( layout, layout.handleMouseDownEvent, modelNode.id )
							nodeElement.onmouseover =  new EventHandler( layout, layout.handleMouseOverEvent, modelNode.id );
							nodeElement.onmouseout =  new EventHandler( layout, layout.handleMouseOutEvent, modelNode.id );
							return nodeElement;
						} else {
							var nodeElement = document.createElement( 'div' );
							nodeElement.style.position = "absolute";
							nodeElement.style.width = "15px";
							nodeElement.style.height = "15px";
							
							var color = dataNode.color.replace( "#", "" );
							var smiley = dataNode.smiley.replace( "#", "" );
							nodeElement.style.backgroundImage = "url(./img/"+smiley+".png)";
							nodeElement.innerHTML = '<img width="1" height="1">';
							nodeElement.onmousedown =  new EventHandler( layout, layout.handleMouseDownEvent, modelNode.id )
							nodeElement.onmouseover =  new EventHandler( layout, layout.handleMouseOverEvent, modelNode.id );
							nodeElement.onmouseout =  new EventHandler( layout, layout.handleMouseOutEvent, modelNode.id );
							return nodeElement;
						}
					}
				}

        		layout.forces.spring._default = function( nodeA, nodeB, isParentChild ) {
					return {
						springConstant: 0.07,
						dampingConstant: 0.01,
						restLength: 30
					}
				}
				
        		layout.forces.magnet = function() {
					return {
						magnetConstant: -99999,
						minimumDistance: 50
					}
				}

				
				/* 3) Override the default edge properties builder.
				 * 
				 * @return DOMElement
				 */ 
				layout.viewEdgeBuilder = function( dataNodeSrc, dataNodeDest ) {
					if ( this.svg ) {
						return {
							'stroke': dataNodeSrc.color,
							'stroke-width': '2px',
							'stroke-dasharray': '2,4'
						}
					} else {
						return {
							'pixelColor': dataNodeSrc.color,
							'pixelWidth': '2px',
							'pixelHeight': '2px',
							'pixels': 20
						}
					}
				}

				/* 4) Load up some stuff by hand
				 * 
				 */
				
				layout.model.ENTROPY_THROTTLE=false;

				var nodes = [];
				<?php
				$peopleArray = array();
				$peopleArrayMap = array();
				$albumArray = array();
				$albumArrayMap = array();
				$groupArray = array();	
				$groupArrayMap = array();			
				?>
				var node = new DataGraphNode();
				node.color= "#000000";
				node.smiley= "user";
				node.mass=2.5;				
				layout.ids.push(<?=$fb_user?>);
				layout.names.push("<?=$myName[0]['name']?>");				

				<?php
					$peopleArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
					$peopleArray[] = $fb_user;										
				?>
				
				layout.newDataGraphNode( node );
				layout.screen.addPeople( node , node.id);				
				nodes.push( node );
		
				// Groups + Albums
				<?php
				if($show[2]){
					if(strcmp($albums[0]['aid'],"") == 0){
					}
					else{	?>			
					var node = new DataGraphNode();
					node.color= "#000000";
					node.smiley= "photos";
					node.mass=.5;
	
					layout.ids.push(<?=$albums[0]['aid']?>);
					layout.names.push("<?=$albums[0]['aid']?>");	
					layout.newDataGraphNode( node );
					var neighbor = nodes[0];
					layout.newDataGraphEdge( node, neighbor );
					<?php
						$albumArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
						$albumArray[] = $albums[0]['aid'];											
					?>	
					layout.screen.addAlbum( node , node.id);
					nodes.push( node );	
				<?php } 
				}
				?>				
				<?php
				if($show[1]){
					if(strcmp($groups[0]['gid'],"") == 0){
					}
					else{	?>	
					var node = new DataGraphNode();
					node.color= "#000000";
					node.smiley= "group";
					node.mass=.5;
	
					layout.ids.push(<?=$groups[0]['gid']?>);
					layout.names.push("<?=$groups[0]['gid']?>");
					layout.newDataGraphNode( node );
					var neighbor = nodes[0];
					layout.newDataGraphEdge( node, neighbor );
					<?php
						$groupArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
						$groupArray[] = $groups[0]['gid'];												
					?>
					layout.screen.addGroup( node , node.id);
					nodes.push( node );
				<?php } 				
				}				
				?>

				// END
				
				<?php
				
				if($show[0]){					
					for($i = 0; $i < 40; $i++){//count($friends); $i++){		
						
						$id = $friends[$i];
						$arr =explode(" ",$id[uid]);
						$id = $arr[0];		

						$name = $friends[$i]['first_name'];	
						$surname = $friends[$i]['last_name'];			
						
						
				?>			
					var node = new DataGraphNode();
					node.color= "#000000";
					node.smiley= "user";
					node.mass=.5;
					layout.ids.push(<?=$id?>);	
					layout.names.push("<?=$name?>"+ " <?=$surname?>");									
					layout.newDataGraphNode( node );	
					
					<?php

					$uids1 = array();
					$face_id = array();
				
					for($k = 0; $k < sizeof($peopleArray); $k++){						
						$uids1[$k] = $id;
						$face_id[$k] = $peopleArray[$k];
					}			
					$uidpairs = $facebook->api_client->friends_areFriends($uids1,$face_id);					
										
					for($j = 0; $j < sizeof($peopleArray); $j++){
						if(strcmp($uidpairs[$j]['are_friends'],"0")){ ?>						
								layout.newDataGraphEdge( node, nodes[<?=$peopleArrayMap[$j]?>]);					
						<?php 
						}			
					} ?>
								
					layout.screen.addPeople( node , node.id);				
					nodes.push( node );

					var myModel = new Model(<?=(sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray))?>, "<?=$friends[$i]['sex']?>", "<?=$friends[$i]['relationship_status']?>");

					<?php
					for($k = 0; $k < $friends[$i]['meeting_for'].length; $k++){
					?>
						myModel.addLookingFor("<?=$friends[$i]['meeting_for'][$k]?>");
					<?php } 
					
					if($k == 0){					
					?>
						myModel.addLookingFor("");
					<?php } ?>

					<?php
					for($k = 0; $k < $friends[$i]['meeting_sex'].length; $k++){
					?>
						myModel.addIntIn("<?=$friends[$i]['meeting_sex'][$k]?>");
					<?php } 
					
					if($k == 0){					
					?>
						myModel.addIntIn("");
					<?php } ?>

					
					
					layout.models.addModel(myModel);
					
					<?php
							$peopleArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
							$peopleArray[] = $id;										
					?>
						
				<?php } 
				}
				
				?>

				globalNodes = nodes;

				/* 5) Control the addition of nodes and edges with a timer.
				 * 
				 * This enables the graph to start organizng as data is loaded.
				 * Use a larger tick time for smoother animation, but slower
				 * build time.
				 */
				buildTimer = new Timer(1);
				buildTimer.subscribe( layout );
				buildTimer.start();

			}		
			
		</script>
		
		
<style type="text/css">
body {
	margin: 0;
	padding: 0;
}
</style>

<script language="JavaScript">

function getSelectedGroups(){

	if(document.getElementById("groups").checked)
		getGroups(layout.screen.selected[0]);
	else if(document.getElementById("albums").checked)
		getAlbums(layout.screen.selected[0]);
}	

function getGroups(str)
{	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
	//id = ids;
				
	var url="getGroups.php";
	url=url+"?q="+str;			
	xmlHttp.onreadystatechange=groupChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function groupChanged() 
{ 			
	if (xmlHttp.readyState==4)
	{ 
		var node = new DataGraphNode();
		node.color= "#0000FF";
		node.smiley= "group";
		node.mass=.5;

		response = xmlHttp.responseText;				
		var response_array = response.split("*-+");

		var id = layout.screen.particles[layout.screen.search(response_array[0])];

		layout.X = layout.model.particles[id].positionX;
		layout.Y = layout.model.particles[id].positionY;

		for(var i = 1; i < response_array.length-1; i++){

			var temp_array = response_array[i].split("+-*");
			
			layout.ids.push(temp_array[0]);
			layout.names.push(temp_array[1]);
			layout.newDataGraphNode( node );
			var neighbor = globalNodes[id];
			layout.newDataGraphEdge( node, neighbor );
			<?php
				$groupArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
				$groupArray[] = 0;												
			?>
			layout.screen.addGroup( node , node.id);
			globalNodes.push( node );		
		}	

		buildTimer.counter -= 20;
		buildTimer.start();
	}
}

function getAlbums(str)
{	
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}
	//id = ids;
				
	var url="getAlbums.php";
	url=url+"?q="+str;			
	xmlHttp.onreadystatechange=albumChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function albumChanged() 
{ 			
	if (xmlHttp.readyState==4)
	{ 
		var node = new DataGraphNode();
		node.color= "#00FF00";
		node.smiley= "photos";
		node.mass=.5;

		response = xmlHttp.responseText;				
		var response_array = response.split("*-+");

		var id = layout.screen.particles[layout.screen.search(response_array[0])];

		layout.X = layout.model.particles[id].positionX;
		layout.Y = layout.model.particles[id].positionY;

		for(var i = 1; i < response_array.length-1; i++){

			var temp_array = response_array[i].split("+-*");
			
			layout.ids.push(temp_array[0]);
			layout.names.push(temp_array[1]);
			layout.newDataGraphNode( node );
			var neighbor = globalNodes[id];
			layout.newDataGraphEdge( node, neighbor );
			<?php
				$albumArrayMap[] = sizeof($peopleArray) + sizeof($groupArray)+ sizeof($albumArray);
				$albumArray[] = 0;												
			?>
			layout.screen.addAlbum( node , node.id);
			globalNodes.push( node );		
		}	

		buildTimer.counter -= 20;
		buildTimer.start();
	}
}

</script>

</head>
<body onload="init(); setLeftMenuImages(); setChecks(); setRightMenu('');" class='fbody'>
<div id="debug" style="position: absolute"></div>
<div id="names" style="position: absolute;bgcolor:#FF0; z-index:15"></div>
<br />
</body>
</html>
